home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-01
/
ohlfind.zip
/
DEFS.H
< prev
next >
Wrap
C/C++ Source or Header
|
1990-07-02
|
4KB
|
163 lines
/* Common definitions for the 'find' package
Copyright (C) 1987, 1990 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "regex.h"
typedef char boolean;
#define true 1
#define false 0
/* Pointer to function returning boolean. */
typedef boolean (*PFB)();
char *malloc ();
int fprintf ();
int printf ();
long time ();
void exit ();
void free ();
PFB find_parser ();
boolean no_side_effects ();
boolean parse_print ();
char *xmalloc ();
struct pred_struct *get_expr ();
struct pred_struct *get_new_pred ();
struct pred_struct *get_new_pred_chk_op ();
struct pred_struct *insert_victim ();
void error ();
void usage ();
void process_path ();
#ifdef DEBUG
void print_tree ();
void print_list ();
#endif /* DEBUG */
/* Argument structures for predicates. */
enum comparison_type
{
COMP_GT,
COMP_LT,
COMP_EQ
};
enum predicate_type
{
NO_TYPE,
VICTIM_TYPE,
UNI_OP,
BI_OP,
OPEN_PAREN,
CLOSE_PAREN
};
enum predicate_precedence
{
NO_PREC,
OR_PREC,
AND_PREC,
NEGATE_PREC,
MAX_PREC
};
struct long_t
{
enum comparison_type kind;
unsigned long l_val;
};
struct size_t
{
short kind;
boolean block;
unsigned long size;
};
struct exec_t
{
short *path_loc;
char **vec;
};
struct pred_struct
{
/* Pointer to the function that implements this predicate. */
PFB pred_func;
#ifdef DEBUG
char *p_name;
#endif
/* The type of this node. There are two kinds. The first is real
predicates ("victims") such as -perm, -print, or -exec. The
other kind is operators for combining predicates. */
enum predicate_type p_type;
/* The precedence of this node. Only has meaning for operators. */
enum predicate_precedence p_prec;
/* True if this predicate node produces side effects. */
boolean side_effects;
/* Information needed by the predicate processor.
Next to each member are listed the predicates that use it. */
union
{
char *str; /* name fstype */
struct re_pattern_buffer *regex; /* regex */
struct exec_t exec_vec; /* exec ok */
struct long_t info; /* atime ctime mtime inum links */
struct size_t size; /* size */
unsigned short uid; /* user */
unsigned short gid; /* group */
time_t time; /* newer */
unsigned long perm; /* perm permmask */
unsigned long type; /* type */
} args;
/* The next predicate in the user input sequence,
which repesents the order in which the user supplied the
predicates on the command line. */
struct pred_struct *pred_next;
/* The right and left branches from this node in the expression
tree, which represents the order in which the nodes should be
processed. */
struct pred_struct *pred_left;
struct pred_struct *pred_right;
};
/* The number of seconds in a day. */
#define DAYSECS 86400
/* The number of bytes in a block for -size. */
#define BLKSIZE 512
extern int errno;
extern char *program_name;
extern struct pred_struct *predicates;
extern struct pred_struct *last_pred;
extern boolean do_dir_first;
extern unsigned long perm_mask;
extern long cur_day_start;
extern boolean full_days;
extern boolean stay_on_filesystem;
extern boolean stop_at_current_level;
extern int exit_status;